
export const jobTypeChoice = [
  { value: 'oracle', label: 'oracle', disabled: false },
  { value: 'mysql', label: 'mysql', disabled: false }
]

export const jobColumns = _this => [
  {
    title: '任务ID',
    key: 'id',
    sortable: true,
    render: (h, { row }) => {
      return <span>{row.id}</span>
    }
  },
  {
    title: '任务名称',
    key: 'name',
    sortable: true,
    render: (h, { row }) => {
      return <router-link to={'/rds/job/' + row.id} style='color: #2d8cf0'>{row.name}</router-link>
    }
  },
  {
    title: '导入方式',
    key: 'import_type',
    width: 150,
    sortable: true,
    render: (h, { row }) => {
      return <span>{row.importType}</span>
    }
  },
  {
    title: '源实例类型',
    key: 'source_instance_type',
    width: 80,
    sortable: true,
    render: (h, { row }) => {
      return <span>{row.sourceInstanceType}</span>
    }
  },
  {
    title: '源实例',
    key: 'source_instance',
    width: 80,
    sortable: true,
    render: (h, { row }) => {
      return <span>{row.sourceInstance.host}</span>
    }
  },
  {
    title: '源数据库',
    key: 'source_database',
    sortable: true,
    render: (h, { row }) => {
      return <span>{row.sourceDatabase.name}</span>
    }
  },
  {
    title: '目标实例类型',
    key: 'dest_instance_type',
    width: 80,
    sortable: true,
    render: (h, { row }) => {
      return <span>{row.destInstanceType}</span>
    }
  },
  {
    title: '目标实例',
    key: 'dest_instance',
    sortable: true,
    render: (h, { row }) => {
      return <span>{row.destInstance.host}</span>
    }
  },
  {
    title: '目标数据库',
    key: 'dest_database',
    sortable: true,
    render: (h, { row }) => {
      return <span>{row.destDatabase.name}</span>
    }
  },
  {
    title: '状态',
    key: 'status',
    width: '120px',
    sortable: true,
    render: (h, { row }) => {
      if (row.status === 1) {
        return <Tag color='green'>执行成功</Tag>
      } else if (row.status === 0) {
        return <Tag>等待执行</Tag>
      } else if (row.status === 2) {
        return <Tag color='warning'>执行中</Tag>
      } else if (row.status === 3) {
        return <Tag color='red'>执行失败</Tag>
      } else {
        return <span>-</span>
      }
    }
  },
  {
    title: '创建时间',
    key: 'create_time',
    sortable: true,
    render: (h, { row }) => {
      return <span>{row.createTime}</span>
    }
  },
  {
    title: '更新时间',
    key: 'update_time',
    sortable: true,
    render: (h, { row }) => {
      return <span>{row.updateTime}</span>
    }
  }
]
